using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Windows.Forms;
using LeisureCenter.Api;

namespace LeisureCenter.Controls
{
    public class TextBox : System.Windows.Forms.TextBox, IFocusHandler
    {
        public TextBox()
        {
            KeyDown += new KeyEventHandler(FocusHandler.HandleControlKeyDown);
        }

        #region IFocusHandler Membres

        private IFocusHandler left;
        [Category("Focus")]
        public IFocusHandler FocusLeft { get { return left; } set { if (value != this) left = value; } }

        private IFocusHandler right;
        [Category("Focus")]
        public IFocusHandler FocusRight { get { return right; } set { if (value != this) right = value; } }

        private IFocusHandler up;
        [Category("Focus")]
        public IFocusHandler FocusUp { get { return up; } set { if (value != this) up = value; } }

        private IFocusHandler down;
        [Category("Focus")]
        public IFocusHandler FocusDown { get { return down; } set { if (value != this) down = value; } }

        [Browsable(false)]
        public Control Control { get { return this; } }

        public bool SetFocus(IFocusHandler source, Keys key)
        {
            return FocusHandler.SetFocus(this, source, key);
        }

        #endregion
    }
}
